Optimized database appliance

ABSTRACT

A system from processing database queries allows for cost and locale based distribution for execution of database queries. The database queries are executed on execution engines that provide flexible configuration and overlapping functionality. The system reduces various costs, including elapsed time, required to perform database queries. The system provides processing of a database query using a database catalog comprising database table locality information, record locality information and execution engine information. A query optimizer receives the query and accesses the database catalog to create a query execution plan comprising locality-based database operations. A central database operation processor providing a first execution engine executes the query execution plan by performing at least a portion of the locality-based database operations and distributing at least a portion of the locality-based database operations as a subplan. A second database operation processor providing a second execution engine executes the subplan received from the central database operation processor. At least one of the database operations can be executed on either the first execution engine or the second execution engine. A storage unit stores at least a portion of database tables and records. A data communications network connects the central database processor to the second database processor.

BACKGROUND OF THE INVENTION

[0001] This invention relates generally to systems for processing database queries, and more specifically to systems for processing database queries by creating a distributed locality, cost-based execution plan.

[0002] Database management systems (DBMS) manage data records stored on storage devices. The data is often distributed across multiple storage devices organized by a server and accessible over a network. A client presents a query, the DBMS processes the query and returns results to the client. These systems suffer from performance problems related to processor speed, memory speed, disk access time and network bandwidth.

[0003] Attempts to solve the performance problem of query processing in a distributed database environment can be generally characterized by three approaches: “fat pipe”, clustering and active disk.

[0004] The “fat pipe” solutions simply attempt to increase overall query processing performance by increasing the network bandwidth. No modification is made to the query processing itself, data and instructions just travel over a faster communications medium. Storage systems manufactured by EMC Corporation of Hopkinton, Mass. exemplify this approach.

[0005] Clustering of computers to perform database queries allows for parallel processing to occur. Parallel computer architectures generally fall into two categories: symmetric multiprocessing (SMP) and massively parallel processing (MPP). SMP systems contain multiple processors which share the same memory containing one copy of the computer application and data. SMP systems reduce transaction time by dividing computer operations into tasks which execute on assigned processors. MPP systems contain many processors, each with their own memory containing a copy of a portion or all of the computer application and/or data. Each processor can then work independently on its portion of the data to reduce overall transaction time. In database systems, data records can be striped across multiple disk drives connected to these clusters of computers. Each computer in a cluster can process parts of the database query on a group of data records that it has access to. Where “fat pipe” solutions attack the database query performance problem by increasing network bandwidth, clustering solutions attack the database query performance problem by increasing processing capacity. Oracle Corporation of Redwood Shores, Calif. provides an SMP clustering solution in its Oracle 8i database product.

[0006] A third approach to improving database query processing performance is “active disk” technology. Active disks combine computer processing with physically linked disk drives to provide parallel processing of database queries that also reduces the load on the communications network. This processing approach may be used to provide database management functionality on a processor closely linked to the database storage device. Conventional and proposed active disk systems only provide fixed functionality query processors and do not provide overlapping query processor functionality. Systems exemplifying this approach are described below.

[0007] A thesis by Eric Reidel entitled “Active Disks—Remote Execution for Network Attached Storage” (Technical Report CMU-CS-99-177, Pittsburgh, Pa., November 1999) describes disks with programmable processors. The thesis evaluates scan-based algorithms that allow for parallel processing of database queries. Reidel proposes a massively parallel processing (MPP) system using identical processors.

[0008] Another active disk system is described in a paper entitled “Active Disks: Programming Model, Algorithm and Evaluation” by Acharya (University of California Santa Barbara), Uysal (University of Maryland College Park) and Saltz (University of Maryland College Park) (Proceedings of the 8th International Conference on Architectural Support for Programming Languages and Operating Systems ASPLOS VIII, October 1998). The paper by Acharya et. al. describes a concept of moving processing closer to disks, but lacks a teaching of an overall database architecture outlining where and how all database operations are organized and optimally executed.

[0009] The 1999 doctoral dissertation by Kimberly Keeton of the University of California Berkeley, entitled “Computer Architecture Support for Database Applications” describes the concept of “intelligent disks” or “idisks” as an array of intelligent disk controllers. The idisks are user programmable processors and memory packaged on a disk storage device coupled to a high speed communications link. The idisks in the array can work together to provide parallel processing of database queries. Keeton only describes a single type of processor with non-overlapping functionality. Alternative future architectures are hinted at, but not enabled. Also at the University of California Berkeley research on introspective storage or “istore” has been done by David Patterson (http://istore.cs.berkeley.edu). Istore proposes the concept of intelligent disk “bricks” configured on a chassis having redundant components for “self-healing”. Each brick comprises a CPU, memory, redundant network interfaces and a disk drive. The istore architecture is similar to Keeton's idisk architecture and suffers from many of the same deficiencies.

[0010] Commercial attempts to provide improved speed for processing database queries include a system sold by Teradata, a division of NCR Corporation. Teradata provides classic MPP database query processing systems having two classes of fixed function processors. The first class of processors are Access Module Processors (AMP) which execute queries in parallel. The AMPs access data on directly attached disk drives. The second class of processors are InterFace Processors (IFP). The IFPs parse, optimize and direct execution of the database queries executed on the AMPs. IFPs and AMPs are connected using a redundant, tree-shaped interconnect. The AMP/IFP architecture provides only one type of execution processor without overlapping functionality capability and no multiple locale optimization or execution options. Teradata has evolved the hardware-based AMP/IFP architecture into a hardware/software architecture with nodes running software versions of the AMP and IFP processors, but the AMP and IFP processes still are restricted to the fixed functionality of the hardware-based architecture. The software-based architecture also does not provide multiple locale optimization or execution options.

SUMMARY OF THE INVENTION

[0011] The present invention provides a system for processing database queries that allows for cost and locale based distributed execution of database queries on a parallel, multi-locale processing system. The database queries are processed on execution engines that provide flexible processor configuration and overlapping processor functionality. The system reduces various costs, including elapsed time, required to perform database queries.

[0012] The present invention provides a system for processing a query on a database having a database catalog comprising database table locality information, record locality information, execution engine information, and characteristics of the various system components such as processing capabilities and performance. A query optimizer receives the query and accesses the database catalog to create a query execution plan comprising locality-based database operations. A first execution engine associated with a central database operation processor executes the query execution plan by performing at least a portion of the locality-based database operations and distributing at least a portion of the locality-based database operations to a second database operation processor as a subplan. A second execution engine associated with a second database operation processor executes the subplan received from the central database operation processor. At least one of the database operations can be executed on either the central execution engine or the second execution engine. Data is stored on a storage unit connected to the second database operation processor which stores at least a portion of database tables and records. A portion of the database tables and records may also be stored on a storage unit connected to the central database operation processor. A data communications network connects the central database processor to the second database operation processor.

[0013] Configurations of the present invention allow for the execution engines to process data received from the storage unit or the data communications network as a data stream. An execution engine can comprise any combination of processing devices and any number of processing devices. In one embodiment of the present invention an execution engine comprises a general purpose CPU and a Field Programmable Gate Array (FPGA). Alternate configurations of the execution engines comprise various combinations of one or more of a general purpose CPU, an FPGA, an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), micro-controller, or other similar device. The processing devices can be arranged in a symmetric multiprocessing (SMP), massively parallel processing (MPP) or other configuration.

[0014] The present invention provides for many dynamic operations. In one particular embodiment, a query optimizer tracks performance results from queries and reallocates the database tables and records in order to create improved query execution. The execution engines dynamically track performance results from queries and modify the query execution plan to improve performance. The execution engines can also be dynamically reconfigured to process different database operations.

[0015] The present invention provides for storage units to be divided into sections and having locality information comprising: a section indicator indicating which section stores a database table, and a distribution indicator indicating whether the database table is striped or broadcast to the section.

BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The foregoing and other objects, features and advantages of the invention will be apparent from the following more particular description of preferred embodiments of the invention, as illustrated in the accompanying drawings in which like reference characters refer to the same parts throughout the different views. The drawings are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the invention.

[0017]FIG. 1 is a block diagram of a database appliance configured according to the principles of the present invention.

[0018]FIG. 2 is a block diagram of one of the Snippet Processing Units shown in FIG. 1.

[0019]FIG. 3 is an illustration of the logical components of a database appliance configured according to the principles of the present invention.

[0020]FIG. 4 is an illustration of the general execution plan distribution process.

[0021]FIG. 5 is an illustration of the distribution of a basic execution plan.

[0022]FIG. 6 is an illustration of an alternative distribution of a basic execution plan.

[0023]FIG. 7 is an illustration of a dynamically reconfigured execution plan.

[0024]FIG. 8 is an illustration of another alternative distribution of a basic execution plan.

DETAILED DESCRIPTION OF THE INVENTION

[0025] A description of preferred embodiments of the invention follows.

[0026]FIG. 1 is a block diagram of a database appliance 100 configured according to the principles of the present invention. The database appliance 100 includes a central database operation processor 106 for processing database requests received from a client 102 and a plurality of data storage units 108 storing portions of the database. In an embodiment shown, the data storage units 108 are disk drives, but the invention may use any alternative data storage technology. Each of the plurality of storage units 108 is coupled to a respective Snippet Processing Unit Controller 122 or central database operation processor CPU 120. The storage units and Snippet Processing Unit Controller may be connected electrically, optically or by any other data connection technology. The central database operation processor may be a separate device or an SPU may serve as a central database operation processor.

[0027] In one embodiment, each Snippet Processing Unit (SPU) 110 includes a respective Snippet Processing Unit Controller 122 and a respective storage unit 108. In an alternative embodiment, each Snippet Processing Unit Controller 122 may be associated with more than one storage unit 108. Each SPU is coupled to the central database operation processor 106 through a data communication network 112. This array of SPUs can be considered an MPP configuration.

[0028] The central database operation processor manages tables for the database stored in the plurality of storage units. Routines for managing and accessing records stored in the database are stored in central database operation processor memory 114 and portions of the database can be copied from the storage units and stored in central database operation processor memory or local storage. The central database operation processor receives database queries from the client 102 transmitted over a data communications network 112. A network interface component 116 in the central database operation processor receives the database queries. A network interface component may be a network interface card, switch or router, Fibre Channel transceiver, InfiniBand-enabled device, or other device programmed to transmit and receive messages according to standardized data network protocols.

[0029] A Central Processing Unit (CPU) 120 in the central database operation processor processes a received database query and forwards pieces of a query execution plan through a network interface component 116 over the data communications network 112 to the SPU storing the requested record. In an alternative embodiment, there are multiple CPUs configured as an SMP array. The piece of the query execution plan forwarded to either the central database operation processor execution engine or SPU for processing is referred as to a “snippet”. The snippet can include database operations such as join, sort, aggregate, restrict, reject, expression evaluation, statistical analysis or other operations. Database requests can be processed more efficiently by off-loading some of the processing from the central database operation processor to the SPUs.

[0030] Data records from one logical database table may be stored across multiple data storage units 108 using various distribution techniques. Storage units may be grouped into “sections,” each section consisting of one or more storage units. Sectioning is a logical grouping that may vary from table to table, i.e., the sectioning scheme associated with a given table may differ from the sectioning scheme associated with another table. The data records may be replicated to all data storage units 108, in a broadcast fashion. Alternately, certain data records may be stored on specific data storage units 108 or sections, in a striping fashion. The stored data records may also be mirrored across multiple data storage units 108 or sections for improved reliability and performance. A portion of the database tables and records may also be stored on a storage unit connected to the central database operation processor. The distribution technique may vary from table to table.

[0031]FIG. 2 is a block diagram of one of the Snippet Processing Units 110 shown in FIG. 1. The SPU 110 includes memory 206, a processing unit 201, a network interface component 204 coupled to the data communication network 112 and a storage controller interface 208 (e.g., an IDE controller interface) coupled to a storage controller 200 (e.g., IDE disk drive controller). Processing unit 201 includes a central processing unit 202 and can also include a programmable processing unit 203. The SPU Controller 122 is coupled to data storage 108 through storage controller interface 208. Data storage 108 (e.g., a disk subsystem) contains a storage controller 200 and a disk drive 218. A connection 212 (e.g., disk cable) couples connector 210 a on the SPU Controller to connector 210 b on the storage controller 200. In one embodiment, the storage controller interface is the American National Standards Institute (ANSI) AT Attachment interface (ATA), commonly referred to as the Integrated Drive Electronics (IDE) interface. The disk drive 218 stores database records. In other embodiments, the data storage units 108 may be replaced by a storage subsystem utilizing technologies other than disk drives, such as random access memory.

[0032]FIG. 3 is an illustration of the logical components of a database appliance configured according to the principles of the present invention. A database query 250 is presented to central database operation processor 106. The database query 250 may be initiated by any conventional source, such as a user, an interactive database query, a call through an application programming interface (API) or a system function. A database query is an instruction to process a data retrieval, manipulation or definition operation on a database. A popular language for expressing database queries is the Structured Query Language (SQL). The following examples of database queries will use SQL, although the principles of the present invention allow for processing of a database query written in any language.

[0033] A central database operation processor 106 is connected to multiple SPUs 110 through data communications network 112. There can be multiple central database operation processors 106 and data communication networks 112 in a database appliance 100.

[0034] A parser/validator 252 parses and checks the syntax of the database query 250. If the syntax is correct a query tree is produced, otherwise an error is generated. A query optimizer 254 takes the query tree as input and generates an execution plan 258 using metadata from the primary database catalog 256. A system optimizer 255 monitors data storage and execution plan 258 history in order to update the primary database catalog 256. Parts, or snippets, of the execution plan 258 are distributed and executed on various execution engines (e.g., central database operation processor execution engine 260, SPU execution engine 264 and programmable execution engine 270) within database appliance 100. The results of executing the snippets are aggregated on a central database operation processor execution engine (e.g., central database operation processor execution engine 260) and made available for further processing (e.g., printing).

[0035] Query optimizer/scheduler 254 creates an optimal execution plan by combining possible ways of scanning and joining tables that appear in the database query 250 to achieve the desired result. The execution plan comprises basic database processing steps including: scan data, project, restrict, sort, hash, group, join, distribute, return, broadcast, etc. Each step can be comprised of multiple substeps. Each step is associated with a locale (i.e., an execution engine). The query optimizer/scheduler 254 then chooses the optimal execution plan based on the processing capabilities, performance characteristics and current workloads of various components and the locality of the data records within the database appliance 100. Query optimizer/scheduler 254 can alter the query tree both in form (adding, deleting, rearranging) database operations and in content (modifying) database operations, in addition to assigning operations to various execution engines. Query optimizer/scheduler 254 calculates the optimal query plan based on the lowest cost by considering possible steps, possible locales and data table access variants for each step of the execution plan.

[0036] Primary database catalog 256 stores the performance characteristics of the various components and the locality of the data records within the database appliance 100. Performance characteristics include, for example, availability of specific database operations on the execution engine, execution engine processor speed, execution engine processor cache configuration, data disk speed, data disk controller speed, data disk controller interface bandwidth, memory availability, memory speed, network interface controller speed and network interface bandwidth. Locality information includes, for example, database table definitions, storage methods and database record count statistics. Using these characteristics and locality information, query optimizer 254 can analyze the costs associated with various execution plans in order to choose the optimal plan. The optimal execution plan is generally considered to be the execution plan that will take the least elapsed time to complete. Other definitions of optimal (e.g., minimize I/O seeks or fabric traffic) are possible and the query optimizer 254 can be configured to create execution plans based on alternative definitions of optimal.

[0037] Execution plan 258 is comprised of various parts (snippets). Snippets represent one or more database operations (e.g., scan, restrict, project, join, etc.) and a locality designation (e.g., central database operation processor, SPU, etc.). The snippets are distributed to the various execution engines for processing and the results are aggregated at a designated central database operation processor execution engine. The ability to distribute the snippets to different execution engines provides for parallel processing of database query 250. Parallel processing reduces the elapsed time to process the database query 250.

[0038] System optimizer 255 monitors data storage usage and requirements. As execution plans 258 are executed statistics are gathered and maintained in primary database catalog 256. System optimizer 255 maintains various usage statistics in order that query optimizer 254 can adjust execution plans 258 for optimal execution. System optimizer 255 is also used to detect reallocation thresholds and participates in planning for reallocation of data when certain predefined thresholds are met.

[0039] System components can also dynamically reconfigure the execution plan created by the system optimizer and redirect operations to other components as needed. For example, if an SPU cannot perform an assigned operation for any reason (such as running out of memory), the SPU can change the assigned locality (e.g., to the central database operation processor) of that operation and any dependent subsequent operations in the execution plan. Similarly, a central database operation processor could direct operations to SPUs.

[0040] Central database operation processor execution engine 260 provides processing for database operations including the aggregation of data from other database operations. Central database operation processor 106 is connected to the SPU 110 through data communication network 112.

[0041] SPU 110 receives a SPU execution plan 262 containing database operations to be performed on data records stored on data storage units 108. SPU execution engine 264 executes the database operations and/or distributes them to a programmable execution engine 270. SPU execution engine 264 accesses a supplemental database catalog 266 to determine optimal distribution, in the same fashion the query optimizer 254 accesses primary database catalog 256. The resulting programmable engine execution plan 268 is then executed on programmable execution engine 270.

[0042] In one particular embodiment, the programmable execution engine 270 is a field programmable gate array (FPGA) configured specifically to perform certain database operations. Using input parameters, the FPGA can be reconfigured to perform various database operations selected from a set of preprogrammed operations. In another embodiment, programmable execution engine 270 is an application specific integrated circuit (ASIC) specifically configured to perform various database operations. Both the FPGA and ASIC implementations allow for increased speed in the execution of database operations as actual database instructions can be implemented in hardware/firmware. In other embodiments, various combinations of general purpose CPU, FGPA and ASIC, as well as other processing devices, can be used to implement the SPU execution engine 264 and programmable execution engine 270 without departing from the scope of the present invention.

[0043] The various execution engines within database appliance 100 provide for distributing database functionality in a flexible manner. Each execution engine can execute many different database operations. The configuration of the database engines is maintained in the database catalogs, thereby allowing the query optimizer 254 to adjust the generation of execution plans 258 as the configuration of the execution engines changes. This flexibility allows for the dynamic reconfiguration of database records and database operations to suit specific performance needs without affecting the underlying operation of query optimizer 254. In this way database operations are executed by the most appropriate execution engine. For example, for a given query, record scanning maybe done on SPU execution engine 264, restriction operations may be done on programmable execution engine 270 and join operations may be done on central database operation processor execution engine 260.

[0044] The present invention provides overlapping functionality of database operations, as the various execution engines (central database operation processor execution engine 260, SPU execution engine 264, programmable execution engine 270) provide a subset of database operations. Because database appliance 100 provides for flexible distribution of database operation execution, multiple execution engines can provide overlapping functionality that is invoked based on external factors (e.g., data record layout, number of data records, performance characteristics of the execution engines, etc.).

[0045]FIG. 4 is an illustration of the general execution plan distribution process. Generally, an execution plan 300 is produced as the result of a database query being processed by a parser/validator and a query optimizer 254. The execution plan is then broken into execution subplans (e.g., distributed execution plan 302, distributed execution subplan 304 and distributed execution subplan 306). Because of the flexibility and overlapping functionality of database appliance 100 each execution subplan can be distributed and executed on a variety of subplan execution engines (e.g., subplan execution engine 308, subplan execution engine 310 and subplan execution engine 312).

[0046] As an aid in the illustration of a distribution of a basic execution plan a store sales database example will be presented that defines a Sales data table and a SalesDetail data table as follows:

[0047] Sales

[0048] TransactionID

[0049] SaleDate

[0050] StoreLocation

[0051] SalesDetail

[0052] TransactionID

[0053] ProductCategory

[0054] Units

[0055] Amount

[0056] A sample query on the store sales database may be “show me the total units and dollar amount of rain gear sold in North Carolina in 2000, by month.” This can be translated into the SQL statement: SELECT Month(Sales.SaleDate) AS “Month”, Sum(SalesDetail.Units) AS “Sales units”, Sum(SalesDetail.Amount) AS “Sales amount” FROM Sales, SalesDetail WHERE Sales.TransactionlD = SalesDetail.TransactionID AND Sales.StoreLocation = “NC” AND Year(Sales.SaleDate)=“2000” AND SalesDetail.ProductCategory = “Raingear” GROUP BY Month(Sales.SaleDate)

[0057] The output from the sample query showing the total units and dollar amount of rain gear sold in North Carolina in 2000 by month can be shown in tabular format: Month Sales Units Sales Amount January 1,300 $45,000 February 1,200 $41,000 March 1,800 $60,000 April 3,500 $98,000 May 4,200 $112,000 June 5,000 $150,000 July 4,700 $143,000 August 4,100 $104,000 September 3,600 $101,000 October 2,000 $65,000 November 1,200 $41,000 December 1,500 $43,000

[0058] In a particular embodiment, the database appliance 100 can be configured to provide for the distribution of database operation execution for this query as follows: Execution Engine Database Operation Central database operation GROUP 358, AGGREGATE 362, processor execution engine ORDER 360, PROJECT 354, JOIN 356, (CDBP) 260 SAVE 364 SPU execution engine SCAN 352, PROJECT 354, JOIN 356, (SPU) 264 GROUP 358, SAVE 364 Programmable execution RESTRICT 350 engine (PXE) 270

[0059]FIG. 5 is an illustration of the distribution of a basic execution plan. Using the above example a basic execution plan can be created by query optimizer 254 that performs joins on the SPU execution engine 264 and performs aggregate functions on the SPU execution engine 264 and central database operation processor execution engine 260, with restriction functions being performed on the programmable execution engine (PXE) 270. Locale Operation SPU SCAN SaleDetail PXE RESTRICT ProductCategory = “Raingear” SPU PROJECT TransactionID, Units, Amount SPU SAVE As TEMPDetail SPU SCAN Sale PXE RESTRICT StoreLocation = “NC” AND Year(SaleDate)=“2000” SPU PROJECT TransactionID, Month(SaleDate) As “Month” SPU JOIN WITH TEMPDetail, TransactionID=TEMPDetail.TransactionID SPU PROJECT Month, TEMPDetail.Units As “Units” TEMPDetail.Amount As “Amt” SPU GROUP By Month SPU AGGREGATE Sum(Units) As “Units”, Sum(Amt) As “AmtTotal” SPU RETURN CDBP GROUP By Month CDBP AGGREGATE Sum(Units) As “Sales Units”, Sum(AmtTotal) As “Sales amount” CDBP ORDER BY Month CDBP PROJECT Month, “Sales Units”, “Sales amount“ CDBP RETURN

[0060]FIG. 6 is an illustration of an alternative distribution of a basic execution plan. Here joins are performed on the SPU execution engine 264 and aggregate functions are performed on the central database operation processor execution engine 260. Locale Operation SPU SCAN SalesDetail PXE RESTRICT ProductCategory = “Raingear” SPU PROJECT TransactionID, Units, Amount SPU SAVE As TEMPDetail SPU SCAN Sales PXE RESTRICT StoreLocation = “NC” AND Year(SaleDate)= “2000” SPU PROJECT TransactionID, Month(SaleDate) As “Month” SPU JOIN WITH TEMPDetail, TransactionID=TEMPDetail.TransactionID SPU PROJECT TransactionID,Month, TEMPDetail.Units As “Units”,TEMPDetail.Amount As“Amt” SPU RETURN CDBP GROUP By Month CDBP AGGREGATE Sum(Units) As “Sales Units”, Sum(Amt) As “Sales amount” CDBP ORDER BY Month CDBP PROJECT Month, “Sales Units”, “Sales amount” CDBP RETURN

[0061]FIG. 7 is an illustration of a dynamically reconfigured execution plan showing how a system component can dynamically reconfigure the execution plan described in conjunction with FIG. 6 in response to a problem. For purposes of this example, assume that, for this query, an SPU is unable to perform all of its assigned operations (e.g., due to running out of memory) and, as a result, redirects some operations to the central database operation processor. Locale Operation SPU SCAN SalesDetail PXE RESTRICT ProductCategory = “Raingear” SPU PROTECT TransactionID, Units, Amount SPU SAVE As TEMPDetail {This operation fails due to lack of memory} SPU RETURN CDBP SAVE As TEMPDetail SPU SCAN Sales PXE RESTRICT StoreLocation = “NC” AND Year(SaleDate)=“2000” SPU PROJECT TransactionID, Month(SaleDate) As “Month” SPU RETURN CDBP JOIN WITH TEMPDetail, TransactionID=TEMPDetail.TransactionID CDBP PROJECT TransactionID,Month, TEMPDetail.Units As “Units”,TEMPDetail.Amount As“Amt” CDBP GROUP By Month CDBP AGGREGATE Sum(Units) As “Sales Units”, Sum (Amt) as “Sales amount” CDBP ORDER By Month CDBP PROJECT Month, “Sales Units”, Sales amount” CDBP RETURN

[0062]FIG. 8 is an illustration of another alternative distribution of a basic execution plan. Here join and aggregate functions are performed on the central database operation processor execution engine 260. Locale Operation SPU SCAN SaleDetail PXE RESTRICT ProductCategory = “Raingear” SPU PROJECT TransactionID, Units, Amount SPU RETURN CDBP SAVE As TEMPDetail SPU SCAN Sale PXE RESTRICT StoreLocation = “NC” AND Year(SaleDate)=“2000” SPU PROJECT TransactionID, Month(SaleDate) As “Month” SPU RETURN CDBP JOIN WITH TEMPDetail, TransactionID=TEMPDetail.TransactionID CDBP PROJECT Month, TEMPDetail.Units As “Units”, TEMPDetail.Amount As“Amt” CDBP GROUP By Month CDBP AGGREGATE Sum(Units) As “Sales Units”, Sum(Amt) As “Sales amount” CDBP ORDER BY Month CDBP PROJECT Month, “Sales Units”, “Sales amount” CDBP RETURN

[0063] While this invention has been particularly shown and described with references to preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the invention encompassed by the appended claims. A database query is meant to encompass all data manipulation (e.g., select, insert, delete and update) and data definition (e.g., create table, drop table) instructions. 

What is claimed is:
 1. A system for processing a query on a database comprising: a database catalog comprising database table locality information, record locality information, execution engine information and characteristics of the system components; a query optimizer receiving the query and accessing the database catalog to create a query execution plan comprising locality-based database operations; a central database operation processor providing a first execution engine executing the query execution plan by performing at least a portion of the locality-based database operations and distributing at least a portion of the locality-based database operations as a subplan; a second database operation processor providing a second execution engine executing the subplan received from the central database operation processor; a storage unit storing at least a portion of database tables and records connected to at least one of the central database operation processor and the second database operation processor; a data communications network connecting the central database operation processor to the second database operation processor; and wherein at least one of the database operations can be executed on either the first execution engine or the second execution engine.
 2. The system of claim 1 wherein the central database operation processor is configured as a symmetric multi-processing system and the second database operation processor is configured as a component of a massively parallel processing system.
 3. The system of claim 1 wherein the first execution engine or the second execution engine processes data records received from the storage unit by performing one or more operations on the data records without materializing the data record into a memory.
 4. The system of claim 1 wherein the first execution engine or the second execution engine processes data records received from the data communications network by performing one or more operations on the data records without materializing the data record into a memory.
 5. The system of claim 1 wherein the first execution engine and the second execution engine have at least some different processing capabilities.
 6. The system of claim 1 wherein the storage unit is electrically connected to the second database operation processor.
 7. The system of claim 1 wherein the storage unit is optically connected to the second database operation processor.
 8. The system of claim 1 wherein the storage unit is a disk drive.
 9. The system of claim 1 wherein the storage unit is a random access memory.
 10. The system of claim 1 wherein a portion of the database is stored on a storage unit connected to the central database operation processor.
 11. The system of claim 1 wherein the first execution engine or the second execution engine reconfigures an assigned execution subplan to redirect one or more operations to another execution engine.
 12. The system of claim 1 wherein each execution engine comprises a plurality of processing devices.
 13. The system of claim 1 wherein each execution engine comprises a combination of processing devices.
 14. The system of claim 13 wherein the execution engine comprises a general purpose central processing unit and a field programable gate array.
 15. The system of claim 13 wherein the execution engine comprises a general purpose central processing and an application specific integrated circuit.
 16. The system of claim 13 wherein the execution engine comprises a field programmable gate array and an application specific integrated circuit.
 17. The system of claim 1 wherein a plurality of the storage units are grouped into sections and the locality information comprises: a section indicator indicating which section stores a database table; and a distribution indicator indicating whether the database table is striped or replicated to the section.
 18. The system of claim 1 wherein a system optimizer tracks performance results from the query and reallocates the database tables and records across the storage units in order to improve query execution.
 19. The system of claim 18 wherein the reallocation comprises striping the database tables and records across the storage units.
 20. The system of claim 18 wherein the reallocation comprises replicating the database tables and records across the storage units.
 21. The system of claim 1 wherein at least one of the first execution engine or the second execution engine dynamically track performance results from the executing queries and modify the query execution plan to improve performance.
 22. The system of claim 1 wherein the execution engines dynamically track system configuration and resource utilization from the executing queries and modify the query execution plan to improve system resource utilization.
 23. The system of claim 1 wherein at least one of the first execution engine or the second execution engine are dynamically reconfigured to process different database operations.
 24. The system of claim 1 wherein a designated second database operation processor also serves as the central database operation processor.
 25. A method for generating a distributed locality-based execution plan comprising: receiving a database query; parsing and validating the database query to produce a query tree; and optimizing the query tree to produce a locality-based execution plan by accessing a database catalog comprising database table locality information, record locality information and execution engine information, the locality-based execution plan containing instructions for a central database operation processor providing a first execution engine to execute the locality-based execution plan by performing at least a portion of the locality-based database operations and distributing at least a portion of the locality-based database operations as a subplan to a second database operation processor providing a second execution engine, wherein at least one of the database operations can be executed on either the first execution engine or the second execution engine.
 26. An apparatus for generating a distributed locality-based execution plan comprising: means for receiving a database query; means for parsing and validating the database query to produce a query tree; and means for optimizing the query tree to produce a locality-based execution plan by accessing a database catalog comprising database table locality information, record locality information and execution engine information, the locality-based execution plan containing instructions for a central database operation processor providing a first execution engine to execute the locality-based execution plan by performing at least a portion of the locality-based database operations and distributing at least a portion of the locality-based database operations as a subplan to a second database operation processor providing a second execution engine, wherein at least one of the database operations can be executed on either the first execution engine or the second execution engine.
 27. A computer program product comprising: a computer usable medium for generating a distributed locality-based execution plan; a set of computer program instructions embodied on the computer usable medium, including instructions to: receive a database query; parse and validating the database query to produce a query tree; and optimize the query tree to produce a locality-based execution plan by accessing a database catalog comprising database table locality information, record locality information and execution engine information, the locality-based execution plan containing instructions for a central database operation processor providing a first execution engine to execute the locality-based execution plan by performing at least a portion of the locality-based database operations and distributing at least a portion of the locality-based database operations as a subplan to a second database operation processor providing a second execution engine, wherein at least one of the database operations can be executed on either the first execution engine or the second execution engine. 